package org.huang.mybatis.demo.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.huang.mybatis.demo.dao.AuthUserMapper;
import org.huang.mybatis.demo.model.AuthUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @描述：AuthUserServiceImpl类描述
 * @作者: huanganwei
 * @创建时间: 2018-11-13 00:15:46
 * @版本: 1.0
 */
@Service
public class AuthUserServiceImpl implements  AuthUserService {

    @Autowired
    private AuthUserMapper authUserMapper;

    @Override
    public List<AuthUser> listAll() {
        return authUserMapper.selectAll();
    }

    @Override
    public PageInfo<AuthUser> findAllUser(int pageNum, int pageSize) {
        //将参数传给这个方法就可以实现物理分页了，非常简单。
        PageHelper.startPage(pageNum, pageSize);
        List<AuthUser> userDomains = authUserMapper.selectAll();
        PageInfo result = new PageInfo(userDomains);
        return result;
    }
}
